package com.beta.cust.bind.datasync.controller;

import com.beta.cust.bind.datasync.config.CfgSelfRefreshBean;
import com.beta.cust.bind.datasync.service.wechat.SyncWechatInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/task")
@Slf4j
public class TaskController {

    @Resource
    private SyncWechatInfo syncWechatInfo;

    @Autowired
    private CfgSelfRefreshBean cfgSelfRefreshBean;

    @GetMapping("/syncCustInfo")
    public void syncCustInfo() {
        log.info("手动定时同步企微用户部门信息start");
        syncWechatInfo.syncWechatInfoBatch(cfgSelfRefreshBean.getCorpId());
        log.info("手动定时同步企微用户部门信息end");
    }

}
